<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <h2 id="h2"></h2>
    <input id="input" type="text">
</body>
<script>
    let h2 = document.getElementById("h2");
    let input = document.getElementById("input");
    let data = {
        a: "100"
    };

    Object.defineProperty(data, "a", {
        get(){

        },
        set(value){
            h2.innerText = value
        }
    });
    h2.innerText = data.a;
    input.addEventListener("keyup",inputChange);
    function inputChange(e){
        console.log("e",e);
        data.a = e.target.value
    }
</script>
</html>